/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('umeng-finplus', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateModelTaskRequest {
  param?: {
    modelBcId?: string(name='modelBcId'),
    modelComment?: string(name='modelComment'),
    modelName?: string(name='modelName'),
    modelTags?: string(name='modelTags'),
    taskName?: string(name='taskName'),
  }(name='param'),
}

model CreateModelTaskShrinkRequest {
  paramShrink?: string(name='param'),
}

model CreateModelTaskResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model CreateModelTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateModelTaskResponseBody(name='body'),
}

/**
 * @summary 模型创建申请
 *
 * @param tmpReq CreateModelTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateModelTaskResponse
 */
async function createModelTaskWithOptions(tmpReq: CreateModelTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateModelTaskResponse {
  Util.validateModel(tmpReq);
  var request = new CreateModelTaskShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'param', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.paramShrink)) {
    query['param'] = request.paramShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateModelTask',
    version = '2024-08-30',
    protocol = 'HTTPS',
    pathname = `/CreateModelTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 模型创建申请
 *
 * @param request CreateModelTaskRequest
 * @return CreateModelTaskResponse
 */
async function createModelTask(request: CreateModelTaskRequest): CreateModelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createModelTaskWithOptions(request, headers, runtime);
}

model DetailModelTaskRequest {
  param?: {
    taskId?: string(name='taskId'),
  }(name='param'),
}

model DetailModelTaskShrinkRequest {
  paramShrink?: string(name='param'),
}

model DetailModelTaskResponseBody = {
  code?: string(name='Code'),
  data?: {
    gmtCreate?: string(name='gmtCreate'),
    gmtModified?: string(name='gmtModified'),
    modelBcId?: string(name='modelBcId'),
    modelComment?: string(name='modelComment'),
    modelDownloadUrl?: string(name='modelDownloadUrl'),
    modelName?: string(name='modelName'),
    modelTags?: string(name='modelTags'),
    status?: string(name='status'),
    statusName?: string(name='statusName'),
    taskId?: string(name='taskId'),
    taskName?: string(name='taskName'),
    umengUid?: string(name='umengUid'),
  }(name='Data'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DetailModelTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetailModelTaskResponseBody(name='body'),
}

/**
 * @summary 模型详情
 *
 * @param tmpReq DetailModelTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetailModelTaskResponse
 */
async function detailModelTaskWithOptions(tmpReq: DetailModelTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DetailModelTaskResponse {
  Util.validateModel(tmpReq);
  var request = new DetailModelTaskShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'param', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.paramShrink)) {
    query['param'] = request.paramShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DetailModelTask',
    version = '2024-08-30',
    protocol = 'HTTPS',
    pathname = `/DetailModelTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 模型详情
 *
 * @param request DetailModelTaskRequest
 * @return DetailModelTaskResponse
 */
async function detailModelTask(request: DetailModelTaskRequest): DetailModelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return detailModelTaskWithOptions(request, headers, runtime);
}

model ListModelTaskRequest {
  param?: {
    reserved?: string(name='reserved'),
  }(name='param'),
}

model ListModelTaskShrinkRequest {
  paramShrink?: string(name='param'),
}

model ListModelTaskResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      gmtCreate?: string(name='gmtCreate'),
      gmtModified?: string(name='gmtModified'),
      modelBcId?: string(name='modelBcId'),
      modelComment?: string(name='modelComment'),
      modelDownloadUrl?: string(name='modelDownloadUrl'),
      modelName?: string(name='modelName'),
      modelTags?: string(name='modelTags'),
      status?: string(name='status'),
      statusName?: string(name='statusName'),
      taskId?: string(name='taskId'),
      taskName?: string(name='taskName'),
      umengUid?: string(name='umengUid'),
    }
  ](name='Data'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ListModelTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListModelTaskResponseBody(name='body'),
}

/**
 * @summary 模型任务list
 *
 * @param tmpReq ListModelTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListModelTaskResponse
 */
async function listModelTaskWithOptions(tmpReq: ListModelTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListModelTaskResponse {
  Util.validateModel(tmpReq);
  var request = new ListModelTaskShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'param', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.paramShrink)) {
    query['param'] = request.paramShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListModelTask',
    version = '2024-08-30',
    protocol = 'HTTPS',
    pathname = `/ListModelTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 模型任务list
 *
 * @param request ListModelTaskRequest
 * @return ListModelTaskResponse
 */
async function listModelTask(request: ListModelTaskRequest): ListModelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listModelTaskWithOptions(request, headers, runtime);
}

model ModelStsRequest {
  param?: {
    taskId?: string(name='taskId'),
  }(name='param'),
}

model ModelStsShrinkRequest {
  paramShrink?: string(name='param'),
}

model ModelStsResponseBody = {
  code?: string(name='Code'),
  data?: {
    bucket?: string(name='bucket'),
    endpoint?: string(name='endpoint'),
    id?: string(name='id'),
    path?: string(name='path'),
    secret?: string(name='secret'),
    token?: string(name='token'),
  }(name='Data'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ModelStsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModelStsResponseBody(name='body'),
}

/**
 * @summary 模型创建申请
 *
 * @param tmpReq ModelStsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModelStsResponse
 */
async function modelStsWithOptions(tmpReq: ModelStsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ModelStsResponse {
  Util.validateModel(tmpReq);
  var request = new ModelStsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'param', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.paramShrink)) {
    query['param'] = request.paramShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModelSts',
    version = '2024-08-30',
    protocol = 'HTTPS',
    pathname = `/ModelSts`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 模型创建申请
 *
 * @param request ModelStsRequest
 * @return ModelStsResponse
 */
async function modelSts(request: ModelStsRequest): ModelStsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modelStsWithOptions(request, headers, runtime);
}

model SubmitModelTaskRequest {
  param?: {
    taskId?: string(name='taskId'),
  }(name='param'),
}

model SubmitModelTaskShrinkRequest {
  paramShrink?: string(name='param'),
}

model SubmitModelTaskResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model SubmitModelTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitModelTaskResponseBody(name='body'),
}

/**
 * @summary 模型提交
 *
 * @param tmpReq SubmitModelTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitModelTaskResponse
 */
async function submitModelTaskWithOptions(tmpReq: SubmitModelTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitModelTaskResponse {
  Util.validateModel(tmpReq);
  var request = new SubmitModelTaskShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.param)) {
    request.paramShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.param, 'param', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.paramShrink)) {
    query['param'] = request.paramShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitModelTask',
    version = '2024-08-30',
    protocol = 'HTTPS',
    pathname = `/SubmitModelTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 模型提交
 *
 * @param request SubmitModelTaskRequest
 * @return SubmitModelTaskResponse
 */
async function submitModelTask(request: SubmitModelTaskRequest): SubmitModelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return submitModelTaskWithOptions(request, headers, runtime);
}

